package com.clay.appointment.controller;

import com.clay.appointment.common.response.Result;
import com.clay.appointment.service.DepartmentService;
import com.clay.appointment.vo.hospital.DepartmentVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author : clay
 * @Description:
 * @Date: Create in 18:30 2021/8/18
 * @Modified By:
 */
@Api(tags = "科室接口")
@RestController
@RequestMapping("/department")
public class DepartmentController {
    @Autowired
    private DepartmentService departmentService;

    /**
     * 根据医院编号，查询医院所有科室列表
     * @param hospitalCode 医院编号
     * @return 医院的科室列表
     */
    @ApiOperation(value = "根据医院编号，查询医院所有科室列表")
    @GetMapping("getDeptList/{hospitalCode}")
    public Result<List<DepartmentVo>> getDeptList(@PathVariable String hospitalCode) {
        List<DepartmentVo> list = departmentService.findDepartmentTree(hospitalCode);
        return Result.success(list);
    }


}
